﻿<extend name="Public:base" />
<block name="title"><title>激活帐号</title></block>
<block name="header_styles">

</block>
<block name="main">
    <div id="resbox" class="text-center">
        
        <if condition='$verify eq 1'>
            <p>恭喜您，已激活账户。即将跳转......<span id="showDiv"></span></p>
            <else />
            <if condition="$verify eq 2">
                <p>激活链接已超时。</p>
                <elseif condition='$verify eq 3' />
                <p>您的账户尚未激活，请去邮箱查收激活邮件，注意查看激活邮件是否被系统误认为是广告邮件。</p>
                <elseif condition='$verify eq 4' />
                <p>激活失败。</p>
            </if>
            <button class="btn btn-default" id="btnSendEmail">重新发送激活邮件</button>
        </if>
    </div>
</block>
<block name="footer_scripts">
    <if condition="$verify eq 1">
        <script type="text/javascript">
            require(["jquery"], function ($) {
                var maxSeconds = 6;
                var timer = setInterval(function () {
                    maxSeconds--;
                    if (maxSeconds <= 0) {
                        clearInterval(timer);
                        $("#showDiv").html('正在载入...');
                        window.location.href = "{:U('User/info')}";
                    } else {
                        $("#showDiv").html(maxSeconds + ' 秒后自动跳转');
                    }
                }, 1000);
            });
        </script>
        <else />
        <script type="text/javascript">
            require(["jquery", "kendoui/kendo.web.min", "modules/message"], function ($, k, messageBox) {
                $("#btnSendEmail").on("click", function () {
                    kendo.ui.progress($("#resbox"), true);
                    var url = "{:U('User/sendVerify')}";
                    $.post(url, {}, function (data) {
                        kendo.ui.progress($("#resbox"), false);
                        var vdata = eval(data);
                        messageBox.alert({ content: vdata.msg });
                        return false;
                    }, 'json');
                });
            });
        </script>

    </if>

</block>